package 实验;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class execute {
	public static void main(String[] args) {
		Class class0 = new Class(001,"线性代数","综合楼805","上午八点到九点四十");
        Class class1 = new Class(002,"离散数学","教学楼101","下午一点半到三点十五");
        Class class2 = new Class(003,"java语言","教学楼201","上午十点到十一四十");
        Teachers tea0 = new Teachers(001,"张老师","男",new Class[] {class2});
        Teachers tea1 = new Teachers(002,"魏老师","女",new Class[] {class1});
        Teachers tea2 = new Teachers(003,"庄老师","男",new Class[] {class0});
		Students stu0 = new Students(2020310880,"阿美","计算机","女",new Class[] {class0,class1,class2},new Teachers[] {tea2,tea1,tea0});
        Students stu1 = new Students(2020310881,"李四","计算机","男",new Class[] {class0,class1},new Teachers[] {tea2,tea1});
        Students stu2 = new Students(2020310882,"小芳","物联网","女",new Class[] {class1,class2},new Teachers[] {tea1,tea0});
        Students stu3 = new Students(2020310883,"张三","物联网","男",new Class[] {class0},new Teachers[] {tea2});

        System.out.println("学生编号:"+stu0.id+
                "\n学生姓名:"+stu0.name+
                "\n学生专业:"+stu0.major+
                "\n学生性别:"+stu0.sex);

        for(int i = 0; i<stu0.classes.length; i++){
            System.out.println("课程编号:"+stu0.classes[i].id+"\t课程名称:"+stu0.classes[i].name+"\t上课时间:"
                    +stu0.classes[i].time+"\t上课地点:"+stu0.classes[i].place+"\t教师:"+stu0.teachers[i].name);
        }

        System.out.println("学生编号:"+stu1.id+
                "\n学生姓名:"+stu1.name+
                "\n学生专业:"+stu1.major+
                "\n学生性别:"+stu1.sex);

        for(int i = 0; i<stu1.classes.length; i++){
            System.out.println("课程编号:"+stu1.classes[i].id+"\t课程名称:"+stu1.classes[i].name+"\t上课时间:"
                    +stu1.classes[i].time+"\t上课地点:"+stu1.classes[i].place+"\t教师:"+stu1.teachers[i].name);
        }
        System.out.println("学生编号:"+stu2.id+
                "\n学生姓名:"+stu2.name+
                "\n学生专业:"+stu2.major+
                "\n学生性别:"+stu2.sex);

        for(int i = 0; i<stu2.classes.length; i++){
            System.out.println("课程编号:"+stu2.classes[i].id+"\t课程名称:"+stu2.classes[i].name+"\t上课时间:"
                    +stu2.classes[i].time+"\t上课地点:"+stu2.classes[i].place+"\t教师:"+stu2.teachers[i].name);
        }
        System.out.println("学生编号:"+stu3.id+
                "\n学生姓名:"+stu3.name+
                "\n学生专业:"+stu3.major+
                "\n学生性别:"+stu3.sex);

        System.out.println("课程编号:"+stu3.classes[0].id+"\t课程名称:"+stu3.classes[0].name+"\t上课时间:"
                    +stu3.classes[0].time+"\t上课地点:"+stu3.classes[0].place+"\t教师:"+stu3.teachers[0].name);
        
	    System.out.println("退课后，学生选课信息");
	    try (Scanner scan = new Scanner(System.in)) {
			int d1 = scan.nextInt();
			if(d1 == 1) {
			String[] strArr= {stu0.classes[0].name, stu0.classes[1].name, stu0.classes[2].name};
			List<String> strList = Arrays.asList(strArr);
			List<String> arrayList = new ArrayList<String>(strList);
			if(arrayList.contains("线性代数"))
			{
				arrayList.remove("线性代数");
			}
			System.out.println("阿美剩余的课程为"+arrayList.toString());
			}
			
		}
	
	}
	
	}
